package com.wmyg.antifake.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wmyg.antifake.bean.Bill;
import com.wmyg.antifake.bean.Factory;
import com.wmyg.antifake.bean.FactoryDevice;
import com.wmyg.antifake.dao.FactoryDeviceMapper;
import com.wmyg.antifake.service.FactoryDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FactoryDeviceServiceImpl implements FactoryDeviceService {

    @Autowired
    FactoryDeviceMapper  factoryDeviceDao;

    @Override
    public int insertFactoryDevice(FactoryDevice factoryDevice) {
        return factoryDeviceDao.insertFactoryDevice(factoryDevice);
    }

    @Override
    public List<FactoryDevice> selectFactoryDevice(FactoryDevice factoryDevice) {
        return factoryDeviceDao.selectFactoryDevice(factoryDevice);
    }

    @Override
    public PageInfo<FactoryDevice> selectDeviceByFactoryId(FactoryDevice factoryDevice) {
        PageHelper.startPage(factoryDevice.getPageIndex(), factoryDevice.getPageSize(),"id desc");
        List<FactoryDevice> factoryDeviceList = factoryDeviceDao.selectDeviceByFactoryId(factoryDevice.getFactoryId());
        return new PageInfo(factoryDeviceList);
    }
}
